﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MixScript.BLL.FI;


namespace MixScriptWeb.Accounting.ReportObject
{
    public partial class rptRequestForRemittance : cCommonWeb, IMIxCommon //System.Web.UI.Page
    {
        private static SortDirection sd;
        private static DataTable dt;

        protected void Page_Load(object sender, EventArgs e)
        {


        }
        protected void btnRefresh_click(object sender, EventArgs e)
        {
            LoadData();
        }
        private void LoadData()
        {
            requestRemitances rm = new requestRemitances();
            dt = rm.requestRemitance(ddlMonth.SelectedItem.Value, ddlTahun.SelectedItem.Value);
            bindGridview(gvList, dt);

        }
        public bool isvalid()
        {
            return true;
        }
        protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Deleting")
            {
                cAccHeader hdr = new cAccHeader();
                hdr.deleteJournal((string)e.CommandArgument);
            }
            LoadData();

        }
        protected void gvList_Sorting(object sender, GridViewSortEventArgs e)
        {
            if (sd == SortDirection.Ascending)
            {
                sd = SortDirection.Descending;
            }
            else
            {
                sd = SortDirection.Ascending;
            }

            DataView dataView = new DataView(dt);
            dataView.Sort = e.SortExpression + " " + ShortDirection(sd);

            bindGridview(gvList, dataView);
        }
        protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {

            gvList.PageIndex = e.NewPageIndex;
            bindGridview(gvList, dt);

        }
        
    }
}